<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="image/css.css" type="text/css" />
<title>管理</title>
<style >body{color:#000;background:#fff;padding:6px 0 0;margin:0;position:relative;font-size:12px;}
body,th,td,.p1,.p2{font-family:arial}p,form,ol,ul,li,dl,dt,dd,h3{margin:0;padding:0;list-style:none}
</style>
</head>
<body>
<?php
include 'Nav.php';
include 'configs\config.php';
$mysql = new mysql();
$mysql->open($config);

$show = @trim($_GET['show']);

$query = $mysql->select('*', 'sms_type');


$str = '';
foreach($query as $v)
{
 $str.='<option value="'.$v['ID'].'">'.$v['type_name'].'</option>';
}







$strAddHtml = <<< STRHTML
<form action="?show=adddata" method="post">
分类: <select name="typeid">
__select__</select><br/>
内容: <textarea name="smscontent" rows="4" cols="70"></textarea><br/><br/>
标记: <select name="is">
<option value="0">00</option>
<option value="1">11</option>
<option value="2">22</option></select><br/>
<input type="submit" name="sub" value="================提交,提交==============" /><br/>
</form>
STRHTML;

$strAddHtml = str_replace("__select__", $str, $strAddHtml);

echo $strAddHtml;



$typeid    = @trim($_POST['typeid']);
$smscontent      = @trim($_POST['smscontent']);
$is = @trim($_POST['is']);

if($show == 'adddata'){
		$data =array();
		$data['content'] = $smscontent;
		$data['typeid'] = $typeid;
		$data['isfavorite']  = $is;

		foreach ($data as $value){
			if($value==''){
				header("location:smsmanage.php");
				exit();
			}
		}
		$res = $mysql->insert($data, 'sms_content');
		header("location:smsmanage.php");
}






unset($mysql);
?>
</body>
</html>